package CSISL4pk;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Session {
    
    private int userId;
    private boolean canEdit;
    private String startTime, endTime;
    
    public Session(int userId, boolean canEdit) {
        this.userId = userId;
        this.canEdit = canEdit;
        startTime = getDateTime();
    }
    
    public int getUserId() {
        return userId;
    }
    
    public void setUserId(int userId) {
        this.userId = userId;
    }
    
    public boolean getEdit() {
        return canEdit;
    }
    
    public void setEdit(boolean canEdit) {
        this.canEdit = canEdit;
    }
    
    public String getStartTime() {
        return startTime;
    }
    
    public String getEndTime() {
        return endTime;
    }
    
    public void setEndTime() {
        endTime = getDateTime();
    }
    
    public static String getDateTime() {
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();
        return dateFormat.format(date);
    }

}
